<?php

class PartnersModule extends fvModule {

    function __construct () {
        $moduleName = strtolower(substr(__CLASS__, 0, -6));

        parent::__construct(fvSite::$fvConfig->get("modules.{$moduleName}.smarty.template"), 
                            fvSite::$fvConfig->get("modules.{$moduleName}.smarty.compile"), 
                            fvSite::$Layoult);
    }

    function showIndex() {
        $pager = new fvPager(PartnersManager::getInstance());
        $this->__assign('Partners', $pager->paginate('lang="'.fvSite::$fvSession->get("lang").'"', 'id DESC'));
        return $this->__display('partners_list.tpl');    
    }

    function showEdit() {
        $request = fvRequest::getInstance();
        if (!$Partner = PartnersManager::getInstance()->getByPk($request->getRequestParameter('id'))) {
            $Partner = new Partners();
        }
        $editor = new fvCKEditor();
        $this->__assign(array(
            'Partner' => $Partner,
            'editor' => $editor->editor("n[description]", "n_description", $Partner->description),
        ));
        return $this->__display('partners_edit.tpl');
    }
    
}

?>
